Skip to content

Add a setting to keep threads unread until you mark them read - #8342

Closed
kolsha wants to merge 1 commit into
get-bb:mainfrom
kolsha:feat/manual-read-tracking
Closed

kolsha wants to merge 1 commit into
get-bb:mainfrom
kolsha:feat/manual-read-tracking

Conversation

@kolsha

@kolsha kolsha commented Nov 29, 2026

Copy link
Copy Markdown

Human comments

What was wrong

The app marks a thread read whenever it is visible and the user is active, and marks it read again whenever new replies arrive while it is on screen (useThreadReadTracking). No setting turns this off. So a user who glances at a thread, decides to come back to it later, and leaves loses it from the unread set. A plugin can't fix this cleanly: experimental_thread.read fires after the read is written and doesn't say what caused it (see #8341).

What changed

  • packages/domain/src/app-settings.ts: new general setting markThreadsReadOnView, default true, so nothing changes for anyone else. It is optional in updates, and apps/server/src/routes/system.ts keeps the saved value when an older client omits it, as Add a setting to turn off shell command summaries #5567 does for summarizeShellCommands.
  • apps/app/src/hooks/useThreadReadTracking.ts: new markOnView parameter. When it is false, the hook acts as if no thread were shown, using the existing thread: undefined gating. When it turns on while a thread is open, that thread is treated as freshly opened and marked read.
  • useMarkThreadsReadOnView() in system-queries.ts returns generalSettings.markThreadsReadOnView === true. While system config is still loading this is false, so a cold start straight into a thread never marks it read before the setting is known. This follows ThreadTerminalView's terminalCopyOnSelect === true. Both callers use it: useThreadDetailThread and PluginThreadChat.
  • With the setting off, a thread becomes read only by explicit Mark read (thread menu, thread.markRead shortcut, bb thread read, sdk.threads.markRead) or when the user sends it a turn (server behavior, unchanged).
  • SettingsView.tsx: a switch in Settings → General → Threads & editing. The CLI (bb settings general markThreadsReadOnView false) and sdk.system.updateGeneralSettings work through the existing schema-driven paths.
  • Docs: the general settings table in docs/configuration.md and bb guide customization.
  • Plugin SDK bumped to 0.6.206 because AppSettings is part of the bundled types (the npm version guard failed without it).
  • No daemon wire or protocol changes.

How you verified

  • New tests in useThreadReadTracking.test.tsx: with markOnView: false, a viewed thread stays unread across a visibility change, new attention, and user input. Turning markOnView on while the thread is open marks it read once. Both fail without the markOnView gate.
  • apps/server/test/system/general-settings.test.ts: markThreadsReadOnView added to the check that an opt-out survives saves from older clients (ran with -t markThreadsReadOnView to confirm the case was selected).
  • thread-opening.model.test.tsx covers auto-read on open, so it now stubs useMarkThreadsReadOnView to true.
  • Commands, after rebasing on b0ddaad731:
    • pnpm exec turbo run typecheck for @bb/domain, @bb/db, @bb/server, @bb/app, @bb/cli, @bb/mobile, @bb/sdk, @bb/demo-server, @bb/provider-parity, @bb/client-core: 16/16 passed.
    • turbo run test for @bb/app, @bb/db, @bb/domain, @bb/templates. @bb/app: 7484 passed, 1 failed. The failure was PluginIcon.test.tsx reading a leftover local plugins/connect-next/ directory (only an orphaned node_modules). After removing that directory it passes; it is unrelated to this change.
    • Server general-settings.test.ts (14 passed) and CLI settings.test.ts (23 passed).
    • turbo run lint --filter=@bb/app: 0 errors, no warnings in changed files.
    • packages/plugin-sdk/scripts/check-npm-version-guard.mjs: PASS for 0.6.206.
  • Manual QA on pnpm dev, before the rebase (on 88cf8f644c), using headless Chrome via Playwright against the dev app:
    • Setting off: opened an unread Codex thread (/threads/<id>), saw the reply rendered, pressed a key and moved the mouse. lastReadAt stayed below latestAttentionAt (still unread).
    • Setting on: the same scenario marked it read (lastReadAt updated).
    • Clicking the Settings switch saved markThreadsReadOnView: false on the server (checked with GET /api/v1/system/config).

Fixes #8341

AGENT GENERATED

Opening a thread to glance at it marks it read, so a thread you meant to come
back to disappears from the unread set. The new general setting
markThreadsReadOnView (default true, no behavior change) lets users keep
threads unread until they mark them read or reply. The app does not
auto-mark threads read until system config has loaded, so a cold start
straight into a thread cannot read it before the setting is known.

The plugin SDK version is bumped because AppSettings is part of the bundled
types.
@github-actions github-actions Bot added the needs-approval PR author is not on the approved contributor list label Nov 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @kolsha. It was closed automatically because it does not meet the requirements below yet. This is an automated check, not a review of the change.

Contributor approval. bb reviews pull requests only from approved contributors, and you are not on the list yet. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ), post a link to your pull request, and explain what it changes and why. A maintainer then adds you to the list and reopens the pull request.

See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-approval PR author is not on the approved contributor list

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting to keep threads unread until I mark them read (don't mark read on open)

1 participant